package main

import "fmt"

type Subject interface {
	request()
}

type RealSubject struct{}

func (r *RealSubject) request() {
	fmt.Println("RealSubject: Handling request")
}

type Proxy struct {
	realSubject *RealSubject
}

func (p *Proxy) request() {
	if p.realSubject == nil {
		p.realSubject = &RealSubject{}
	}
	p.realSubject.request()
}
